package com.example.work4

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText
import android.widget.TextView
import androidx.databinding.DataBindingUtil
import com.example.work4.http.SSORetrofitImp
import com.example.work4.po.RegisterInfo

class RegisterActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_register)
    }

    var retro = SSORetrofitImp(this)


    fun sendCode(view: View){
        val input:EditText = findViewById(R.id.email)
        val email = input.text.toString();
        retro.sendEmail(email)
    }


    fun register(view: View){
        val email:EditText = findViewById(R.id.email)
        val nickname:EditText = findViewById(R.id.nickname)
        val password:EditText = findViewById(R.id.password)
        val code:EditText = findViewById(R.id.code)
        val info = RegisterInfo()
        info.username = nickname.text.toString()
        info.code = code.text.toString()
        info.email = email.text.toString()
        info.password = password.text.toString()
        retro.register(info)
    }
}